package com.shaw;

import com.shaw.mybatisx.plugin.Interceptor;
import com.shaw.mybatisx.session.Configuration;
import com.shaw.mybatisx.executor.SimpleExecutor;
import com.shaw.mybatisx.session.SqlSession;
import com.shaw.running.mapper.TestAnnotationMapper;
import com.shaw.running.plugins.Plugins1;
import com.shaw.running.plugins.Plugins2;
import com.shaw.running.plugins.Plugins3;

import java.util.ArrayList;
import java.util.List;

/**
 * Hello world!
 *
 */
public class App 
{

    private static List<Class> clazzs = new ArrayList<Class>();
    private static List<Interceptor> interceptors = new ArrayList<>();
    static {
        clazzs.add(TestAnnotationMapper.class);
        interceptors.add(new Plugins1());
        interceptors.add(new Plugins2());
        interceptors.add(new Plugins3());
    }
    public static void main( String[] args ){

        SqlSession session = new SqlSession(new Configuration(clazzs,interceptors));
        TestAnnotationMapper testMapper = (TestAnnotationMapper) session.getMapper(TestAnnotationMapper.class);
        System.out.println(testMapper.selectByPrimaryKey(1));
    }
}

